/**
 * Created by wangwei on 12/22/16.
 */
$(document).ready(function () {
	$('body').bind('click', bodyHandler)
	$('div').bind('click', divHandler)

	var clickMeButton = $('#clickMeButton')

	$('button').click(function () {
		var e = jQuery.Event('MyEvent')
		clickMeButton.trigger(e)
	})

	clickMeButton.bind('MyEvent', function (e) {
		console.log(e)
	})

})

function bodyHandler(event) {
	console.log('bodyHandler')
	console.log(event)
}

function divHandler(event) {
	console.log('divHandler')
	// event.stopPropagation()

	event.stopImmediatePropagation()
	console.log(event)
}